package com.codefish.framework.spring.beans.factory.support;

import com.codefish.framework.spring.core.utils.ClassUtils;

/**
 * BeanDefinitionReader的抽象实现
 *
 * @author <a href='https://gitee.com/hzf2281'>codefish</a>
 * @version 1.0.0
 * @since 2022/10/01 下午 04:11
 */
public abstract class AbstractBeanDefinitionReader implements IBeanDefinitionReader {
    private final ClassLoader beanClassLoader;

    private IBeanDefinitionRegistry beanDefinitionRegistry;

    public AbstractBeanDefinitionReader() {
        this.beanClassLoader = ClassUtils.getDefaultClassLoader();
    }

    public AbstractBeanDefinitionReader(IBeanDefinitionRegistry beanDefinitionRegistry) {
        this.beanClassLoader = ClassUtils.getDefaultClassLoader();
        this.beanDefinitionRegistry = beanDefinitionRegistry;
    }


    @Override
    public ClassLoader getBeanClassLoader() {
        return this.beanClassLoader;
    }

    public void setBeanDefinitionRegistry(IBeanDefinitionRegistry registry) {
        this.beanDefinitionRegistry = registry;
    }

    @Override
    public IBeanDefinitionRegistry getRegistry() {
        return this.beanDefinitionRegistry;
    }
}
